import { createRouter, createWebHashHistory, createWebHistory, RouteRecordRaw } from "vue-router";
import Setting from "../views/Setting.vue";
import Monitor from '../views/Monitor.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "setting",
    component: Setting,
  },
  {
    path: "/device",
    name: "device",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/Device.vue"),
  },
  {
    path: '/monitor',
    name: 'monitor',
    component: Monitor,
    // 允许查询参数
    props: route => ({
      deviceWxId: route.query.deviceWxId,
      deviceWxName: route.query.deviceWxName
    })
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
